package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos=new FileOutputStream("note.txt");
        OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        Scanner scan=new Scanner(System.in);

        System.out.println("请输入文本，若退出请输入exit");
        while (true){
            String line=scan.nextLine();
            if ("exit".equalsIgnoreCase(line)){
                break;
            }
            osw.write(line);
        }
        osw.close();
    }
}
